package com.tangye.massageshop.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.apache.ibatis.type.Alias;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.util.List;


@EqualsAndHashCode(callSuper = true)
@Data
@AllArgsConstructor
@NoArgsConstructor
@Alias("package")
@TableName(value="t_package",autoResultMap = true)
public class PackageEntity extends BaseEntity{
    @TableId(type = IdType.AUTO)
    private Integer packageId;
    @NotBlank
    private String packageName;
    @NotNull
    private Integer companyId;
    /**
     * 品种
     */
    @TableField(typeHandler = JacksonTypeHandler.class)
    @NotNull
    private List<VarietyEntity> varieties;

    /**
     * 原始价格
     */
    @NotNull
    private BigDecimal originalPrice;

    /**
     * 优惠价格
     */
    @NotNull
    private BigDecimal preferentialPrice;

    @NotBlank
    private String saleChannel;

    private String packageStatus;


    @Data
    static
    class VarietyEntity{
        @NotBlank
        private String varietyName;
        /**
         * 时间
         */
        @NotBlank
        private String timeMinutes;

        /**
         * 原始价格
         */
        @NotNull
        private BigDecimal originalPrice;

    }


}
